package com.bmit.clusterspring.mapper;

import com.bmit.clusterspring.model.ClusterLog;
import com.bmit.clusterspring.model.ClusterLogExample;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface ClusterLogMapper {
    @SelectProvider(type= ClusterLogSqlProvider.class, method="countByExample")
    long countByExample(ClusterLogExample example);

    @DeleteProvider(type=ClusterLogSqlProvider.class, method="deleteByExample")
    int deleteByExample(ClusterLogExample example);

    @Delete({
        "delete from cluster_log",
        "where log_id = #{logId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long logId);

    @Insert({
        "insert into cluster_log (log_id, ip_address, ",
        "algorithm, data_shape_0, ",
        "data_shape_1, cluster_num, ",
        "run_time, gmt_create)",
        "values (#{logId,jdbcType=BIGINT}, #{ipAddress,jdbcType=CHAR}, ",
        "#{algorithm,jdbcType=CHAR}, #{dataShape0,jdbcType=INTEGER}, ",
        "#{dataShape1,jdbcType=INTEGER}, #{clusterNum,jdbcType=INTEGER}, ",
        "#{runTime,jdbcType=INTEGER}, #{gmtCreate,jdbcType=TIMESTAMP})"
    })
    int insert(ClusterLog record);

    @InsertProvider(type=ClusterLogSqlProvider.class, method="insertSelective")
    int insertSelective(ClusterLog record);

    @SelectProvider(type=ClusterLogSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="log_id", property="logId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="ip_address", property="ipAddress", jdbcType=JdbcType.CHAR),
        @Result(column="algorithm", property="algorithm", jdbcType=JdbcType.CHAR),
        @Result(column="data_shape_0", property="dataShape0", jdbcType=JdbcType.INTEGER),
        @Result(column="data_shape_1", property="dataShape1", jdbcType=JdbcType.INTEGER),
        @Result(column="cluster_num", property="clusterNum", jdbcType=JdbcType.INTEGER),
        @Result(column="run_time", property="runTime", jdbcType=JdbcType.INTEGER),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ClusterLog> selectByExample(ClusterLogExample example);

    @Select({
            "select",
            "log_id, ip_address, algorithm, data_shape_0, data_shape_1, cluster_num, run_time, ",
            "gmt_create",
            "from cluster_log"
    })
    @Results({
            @Result(column="log_id", property="logId", jdbcType=JdbcType.BIGINT, id=true),
            @Result(column="ip_address", property="ipAddress", jdbcType=JdbcType.CHAR),
            @Result(column="algorithm", property="algorithm", jdbcType=JdbcType.CHAR),
            @Result(column="data_shape_0", property="dataShape0", jdbcType=JdbcType.INTEGER),
            @Result(column="data_shape_1", property="dataShape1", jdbcType=JdbcType.INTEGER),
            @Result(column="cluster_num", property="clusterNum", jdbcType=JdbcType.INTEGER),
            @Result(column="run_time", property="runTime", jdbcType=JdbcType.INTEGER),
            @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ClusterLog> selectList();

    @Select({
        "select",
        "log_id, ip_address, algorithm, data_shape_0, data_shape_1, cluster_num, run_time, ",
        "gmt_create",
        "from cluster_log",
        "where log_id = #{logId,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="log_id", property="logId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="ip_address", property="ipAddress", jdbcType=JdbcType.CHAR),
        @Result(column="algorithm", property="algorithm", jdbcType=JdbcType.CHAR),
        @Result(column="data_shape_0", property="dataShape0", jdbcType=JdbcType.INTEGER),
        @Result(column="data_shape_1", property="dataShape1", jdbcType=JdbcType.INTEGER),
        @Result(column="cluster_num", property="clusterNum", jdbcType=JdbcType.INTEGER),
        @Result(column="run_time", property="runTime", jdbcType=JdbcType.INTEGER),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP)
    })
    ClusterLog selectByPrimaryKey(Long logId);

    @UpdateProvider(type=ClusterLogSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ClusterLog record, @Param("example") ClusterLogExample example);

    @UpdateProvider(type=ClusterLogSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ClusterLog record, @Param("example") ClusterLogExample example);

    @UpdateProvider(type=ClusterLogSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ClusterLog record);

    @Update({
        "update cluster_log",
        "set ip_address = #{ipAddress,jdbcType=CHAR},",
          "algorithm = #{algorithm,jdbcType=CHAR},",
          "data_shape_0 = #{dataShape0,jdbcType=INTEGER},",
          "data_shape_1 = #{dataShape1,jdbcType=INTEGER},",
          "cluster_num = #{clusterNum,jdbcType=INTEGER},",
          "run_time = #{runTime,jdbcType=INTEGER},",
          "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}",
        "where log_id = #{logId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ClusterLog record);
}